package com.hayrullah.cinema.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "Movie_Table")
public class Movie extends AbstractEntity {

	private static final long serialVersionUID = 1L;

	private String moviename;
	private String category;
	private Date Startdate;
	private Date enddate;
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "Movies_saloon", joinColumns = { @JoinColumn(name = "Movie_id") }, inverseJoinColumns = { @JoinColumn(name = "Saloon_id") })
	private Set<Saloon> saloon;
	
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "Movie_Seans", joinColumns = { @JoinColumn(name = "Movie_id") }, inverseJoinColumns = { @JoinColumn(name = "Seans_id") })
	private Set<Seans> seans;

	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "Movie_Customer", joinColumns = { @JoinColumn(name = "Movie_id") }, inverseJoinColumns = { @JoinColumn(name = "Customer_id") })
	private Set<Customer> customer;

	public Movie() {
	
		this.saloon = new HashSet<Saloon>();
		this.seans = new HashSet<Seans>();
		this.customer = new HashSet<Customer>();

	}

	@Column(name = "movie_name", nullable = false)
	public String getMoviename() {
		return moviename;
	}

	public void setMoviename(String moviename) {
		this.moviename = moviename;
	}

	@Column(name = "category", nullable = false)
	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	@Column(name = "Start_date")
	@Temporal(TemporalType.DATE)
	public Date getStartdate() {
		return Startdate;
	}

	public void setStartdate(Date startdate) {
		Startdate = startdate;
	}

	@Column(name = "End_date")
	@Temporal(TemporalType.DATE)
	public Date getEnddate() {
		return enddate;
	}

	public void setEnddate(Date enddate) {
		this.enddate = enddate;
	}
	
	public Set<Saloon> getSaloon() {
		return saloon;
	}

	
	public void setSaloon(Set<Saloon> saloon) {
		this.saloon = saloon;
	}

	
	public Set<Seans> getSeans() {
		return seans;
	}

	public void setSeans(Set<Seans> seans) {
		
		this.seans = seans;
	}

	public Set<Customer> getCustomer() {
		return customer;
	}

	public void setCustomer(Set<Customer> customer) {
		this.customer = customer;
	}

}
